#析构函数
class Person:

  def __init__(self):
    print("创建对象：{0}".format(self))

  def __del__(self):
    print("销毁对象：{0}".format(self))

p1 = Person()
p2 = Person()
del p2 #就算没有 __del__方法，程序也会销毁对象
print("程序结束")
# 销毁对象：<__main__.Person object at 0x0000024692958910>
# 程序结束
# 销毁对象：<__main__.Person object at 0x0000024692E330E0>